package com.netease.pris.activity;

import android.content.Context;
import android.content.Intent;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.GestureDetector;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager.LayoutParams;
import android.webkit.URLUtil;
import android.widget.FrameLayout;
import android.widget.TextView;
import com.netease.image.video.MonitoredActivity;
import com.netease.imageex.ImageViewTouch;
import com.netease.pris.a.e;
import com.netease.pris.activity.view.n;
import com.netease.pris.activity.view.w;
import com.netease.pris.app.PrisApp;
import com.netease.pris.d.c;
import com.netease.pris.v;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class PRISActivityFlasScreen extends MonitoredActivity
  implements w
{
  private static final int k = 3000;
  private static final int l = 40;
  private static final String m = "start_by_slide";
  private static final String n = "PRISActivityFlasScreen";
  List a = new ArrayList();
  List b = new ArrayList();
  Handler c;
  LayoutInflater d;
  FrameLayout e;
  n f;
  GestureDetector g;
  boolean h;
  AsyncTask i;
  boolean j;
  private int o;
  private boolean p = false;

  // ERROR //
  static Bitmap a(Context paramContext, String paramString)
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_2
    //   2: aload_0
    //   3: ifnull +10 -> 13
    //   6: aload_1
    //   7: invokestatic 60	android/text/TextUtils:isEmpty	(Ljava/lang/CharSequence;)Z
    //   10: ifeq +5 -> 15
    //   13: aload_2
    //   14: areturn
    //   15: aload_0
    //   16: invokevirtual 66	android/content/Context:getAssets	()Landroid/content/res/AssetManager;
    //   19: astore_3
    //   20: aload_3
    //   21: aload_1
    //   22: invokevirtual 72	android/content/res/AssetManager:open	(Ljava/lang/String;)Ljava/io/InputStream;
    //   25: astore 10
    //   27: aload 10
    //   29: astore 5
    //   31: aload 5
    //   33: invokestatic 78	android/graphics/BitmapFactory:decodeStream	(Ljava/io/InputStream;)Landroid/graphics/Bitmap;
    //   36: astore 11
    //   38: aload 11
    //   40: astore_2
    //   41: aload 5
    //   43: ifnull -30 -> 13
    //   46: aload 5
    //   48: invokevirtual 83	java/io/InputStream:close	()V
    //   51: goto -38 -> 13
    //   54: astore 12
    //   56: aload 12
    //   58: invokevirtual 86	java/io/IOException:printStackTrace	()V
    //   61: goto -48 -> 13
    //   64: astore 8
    //   66: aconst_null
    //   67: astore 5
    //   69: aload 8
    //   71: invokevirtual 86	java/io/IOException:printStackTrace	()V
    //   74: aload 5
    //   76: ifnull -63 -> 13
    //   79: aload 5
    //   81: invokevirtual 83	java/io/InputStream:close	()V
    //   84: goto -71 -> 13
    //   87: astore 9
    //   89: aload 9
    //   91: invokevirtual 86	java/io/IOException:printStackTrace	()V
    //   94: goto -81 -> 13
    //   97: astore 4
    //   99: aconst_null
    //   100: astore 5
    //   102: aload 4
    //   104: astore 6
    //   106: aload 5
    //   108: ifnull +8 -> 116
    //   111: aload 5
    //   113: invokevirtual 83	java/io/InputStream:close	()V
    //   116: aload 6
    //   118: athrow
    //   119: astore 7
    //   121: aload 7
    //   123: invokevirtual 86	java/io/IOException:printStackTrace	()V
    //   126: goto -10 -> 116
    //   129: astore 6
    //   131: goto -25 -> 106
    //   134: astore 8
    //   136: goto -67 -> 69
    //
    // Exception table:
    //   from	to	target	type
    //   46	51	54	java/io/IOException
    //   20	27	64	java/io/IOException
    //   79	84	87	java/io/IOException
    //   20	27	97	finally
    //   111	116	119	java/io/IOException
    //   31	38	129	finally
    //   69	74	129	finally
    //   31	38	134	java/io/IOException
  }

  private Bitmap a(Uri paramUri)
  {
    Object localObject;
    try
    {
      if (URLUtil.isAssetUrl(paramUri.toString()))
      {
        String str = paramUri.toString().substring("file:///android_asset/".length());
        localObject = a(PrisApp.a(), str);
      }
      else
      {
        Bitmap localBitmap = BitmapFactory.decodeFile(paramUri.getPath());
        localObject = localBitmap;
      }
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
      localObject = null;
    }
    catch (OutOfMemoryError localOutOfMemoryError)
    {
      while (true)
        localOutOfMemoryError.printStackTrace();
    }
    return (Bitmap)localObject;
  }

  private void a(int paramInt)
  {
    Uri localUri = (Uri)this.b.get(paramInt);
    com.netease.pris.atom.b.a locala = (com.netease.pris.atom.b.a)this.a.get(paramInt);
    if (localUri != null)
    {
      Bitmap localBitmap = a(localUri);
      if (localBitmap != null)
        a(paramInt, localBitmap, locala, 3000L);
    }
    while (true)
    {
      return;
      if ((!this.j) && (this.b.size() > 1))
      {
        int i1 = (paramInt + 1) % this.b.size();
        this.c.postDelayed(new gd(this, i1), 3000L);
        continue;
      }
    }
  }

  private void a(int paramInt, Bitmap paramBitmap)
  {
    Uri localUri = (Uri)this.b.get(paramInt);
    long l1 = 3000L;
    if (localUri != null)
      if (paramBitmap != null)
        a(paramInt, paramBitmap, (com.netease.pris.atom.b.a)this.a.get(paramInt), l1);
    while (true)
    {
      return;
      l1 = 500L;
      if (this.j)
        continue;
      if (this.h)
      {
        this.c.postDelayed(new gd(this, paramInt), l1);
        continue;
      }
      if (this.b.size() <= 1)
        continue;
      int i1 = (paramInt + 1) % this.b.size();
      this.c.postDelayed(new gd(this, i1), l1);
    }
  }

  private void a(int paramInt, Bitmap paramBitmap, com.netease.pris.atom.b.a parama, long paramLong)
  {
    ViewGroup localViewGroup = (ViewGroup)this.d.inflate(2130903044, null);
    localViewGroup.setVisibility(4);
    ((ImageViewTouch)localViewGroup.findViewById(2131558418)).a(paramBitmap, true, true);
    if (parama != null)
    {
      ((TextView)localViewGroup.findViewById(2131558419)).setText(parama.d());
      ((TextView)localViewGroup.findViewById(2131558420)).setText(parama.e());
      if (!TextUtils.isEmpty(parama.f()))
        ((TextView)localViewGroup.findViewById(2131558421)).setText(getString(2131362303) + parama.f());
      paramLong = 1000 * parama.g();
      if (paramLong <= 0L)
        paramLong = 3000L;
    }
    this.e.addView(localViewGroup, 0);
    this.f.a(localViewGroup);
    if ((!this.j) && (paramLong >= 0L) && (this.b.size() > 1))
    {
      int i1 = (paramInt + 1) % this.b.size();
      this.c.postDelayed(new gd(this, i1), paramLong);
    }
  }

  public static void a(Context paramContext)
  {
    Intent localIntent = new Intent(paramContext, PRISActivityFlasScreen.class);
    localIntent.putExtra("start_by_slide", true);
    paramContext.startActivity(localIntent);
  }

  private void b()
  {
    if (!this.h);
    for (boolean bool = true; ; bool = false)
    {
      this.h = bool;
      return;
    }
  }

  private void c()
  {
    String str = e.b(PrisApp.a());
    if (com.netease.pris.b.a.n())
    {
      com.netease.pris.b.a.i(str);
      Intent localIntent2 = new Intent(this, PRISActivityGuide.class);
      localIntent2.putExtra("update", false);
      startActivity(localIntent2);
    }
    while (true)
    {
      finish();
      return;
      if (com.netease.pris.b.a.h(str))
      {
        com.netease.pris.b.a.i(str);
        Intent localIntent1 = new Intent(this, PRISActivityGuide.class);
        localIntent1.putExtra("update", true);
        startActivity(localIntent1);
        continue;
      }
      if (com.netease.pris.b.a.c() == null)
      {
        MainGridActivity.a(this, 0, 1);
        continue;
      }
      MainGridActivity.a(this, 7, 1);
    }
  }

  private void d()
  {
    this.a.clear();
    this.b.clear();
    File localFile = new File(com.netease.pris.c.a.a());
    int i2;
    com.netease.pris.atom.b.a locala;
    if (localFile.exists())
    {
      File[] arrayOfFile = localFile.listFiles();
      if ((arrayOfFile != null) && (arrayOfFile.length > 0))
      {
        List localList = com.netease.pris.c.a.a(this);
        int i1 = arrayOfFile.length;
        i2 = 0;
        if (i2 >= i1)
          break label186;
        this.b.add(Uri.fromFile(arrayOfFile[i2]));
        String str = arrayOfFile[i2].getName();
        if (localList == null)
          break label193;
        Iterator localIterator = localList.iterator();
        while (true)
          if (localIterator.hasNext())
          {
            locala = (com.netease.pris.atom.b.a)localIterator.next();
            if ((locala.c() == null) || (!locala.c().endsWith(str)))
              continue;
            label150: if (locala == null)
              break;
            localList.remove(locala);
          }
      }
    }
    while (true)
    {
      this.a.add(locala);
      i2++;
      break;
      e();
      label186: return;
      locala = null;
      break label150;
      label193: locala = null;
    }
  }

  private void e()
  {
    this.a.clear();
    this.b.clear();
    AssetManager localAssetManager = getAssets();
    try
    {
      String[] arrayOfString = localAssetManager.list("conver");
      for (int i1 = 0; i1 < arrayOfString.length; i1++)
      {
        this.b.add(Uri.parse("file:///android_asset/conver/" + arrayOfString[i1]));
        this.a.add(null);
      }
    }
    catch (IOException localIOException)
    {
      localIOException.printStackTrace();
    }
  }

  public void a(View paramView)
  {
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    this.p = getIntent().getBooleanExtra("start_by_slide", false);
    setDefaultKeyMode(2);
    requestWindowFeature(1);
    setContentView(2130903099);
    this.d = ((LayoutInflater)getSystemService("layout_inflater"));
    this.e = ((FrameLayout)findViewById(2131558417));
    this.f = new n(this, this.e, null);
    this.f.a(this);
    this.c = new Handler();
    this.g = new GestureDetector(new gc(this, (int)(40.0F * getResources().getDisplayMetrics().density)));
    this.i = new at(this);
    this.i.execute(new Void[0]);
  }

  protected void onDestroy()
  {
    super.onDestroy();
    if (this.i != null)
    {
      this.i.cancel(true);
      this.i = null;
    }
  }

  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    if ((paramInt == 4) && (!this.p))
      getWindow().setWindowAnimations(this.o);
    return super.onKeyDown(paramInt, paramKeyEvent);
  }

  protected void onResume()
  {
    if (PrisApp.a().t() == 0)
      v.a().o();
    this.o = getWindow().getAttributes().windowAnimations;
    getWindow().setWindowAnimations(2131427342);
    super.onResume();
    c.b(a());
  }

  public void onStop()
  {
    super.onStop();
    this.j = true;
  }

  public boolean onTouchEvent(MotionEvent paramMotionEvent)
  {
    return this.g.onTouchEvent(paramMotionEvent);
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.pris.activity.PRISActivityFlasScreen
 * JD-Core Version:    0.6.0
 */